//
//  SuitDetailViewController.m
//  PurchasingMeeting
//
//  Created by yanseng.lin on 12/4/13.
//  Copyright (c) 2013 YX. All rights reserved.
//

#import "SuitDetailViewController.h"

@interface SuitDetailViewController ()

@end

@implementation SuitDetailViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil obj:(SuitObject *)obj
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        [self setNavTitle:@"配装详情"];
        suit = obj;
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    if ([[[UIDevice currentDevice]systemVersion]floatValue]>=7.0)
    {
        self.automaticallyAdjustsScrollViewInsets=NO;
    }
    
    UIImage *bgImage = [[UIHelper getInstance] getBundleImage:@"suit_bg.jpg"];
    self.view.backgroundColor = [UIColor colorWithPatternImage:bgImage];
    
    UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
    UIImage *img = [[UIHelper getInstance] getBundleImage:@"anniu.png"];
    [b setBackgroundImage:img forState:UIControlStateNormal];
    [b setTitle:@"返回" forState:UIControlStateNormal];
    b.frame = CGRectMake(10, 10, 99, 37);
    [b addTarget:self action:@selector(ret) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *left = [[UIBarButtonItem alloc] initWithCustomView:b];
    self.navigationItem.leftBarButtonItem = left;
    
#ifdef DHH_iOS
    s = [[SuitView alloc] initWithSuitObject:suit frame:CGRectMake(0, 0, 320, 460)];
    if ([[[UIDevice currentDevice]systemVersion]floatValue]>=7.0)
    {
        s.top = 64;
    }
#else
    s = [[SuitView alloc] initWithSuitObject:suit frame:CGRectMake(0, 0, 1024, 768)];
    if ([[[UIDevice currentDevice]systemVersion]floatValue]>=7.0)
    {
        s.center = CGPointMake(512,384+32);
    }
    else
    {
        s.center = CGPointMake(512,384-32);
    }
#endif
    
     
    [self.view addSubview:s];
    [s loadImage];
    
}

-(void)ret
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}

@end
